#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <algorithm>



/**
 * 时间复杂度 O(nlogn)
 * 空间复杂度 O(1)
 * 
 * 双截棍
 */
int main() {
    int arr[110]{};


    int n;
    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
    }

    std::sort(arr, arr + n);

    int minDiff = arr[1] - arr[0];
    for (int i = 1; i < n - 1; i++) {
        minDiff = std::min(minDiff, arr[i + 1] - arr[i]);
    }

    printf("%d", minDiff);

    return 0;
}
